package com.ruiqiang.init.demo.controller;

import com.ruiqiang.init.demo.domain.Student;
import com.ruiqiang.init.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private StudentService studentService;

    @RequestMapping("/test/{id}")
    public String demoTest(@PathVariable long id) {
        Student student = studentService.selectById(id);
        return "Hello " + student.getStudentName() + "!";
    }
}
